<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonEdit.jsp"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<script language="JavaScript" src="${ctx}/scripts/common/prototype.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<script type="text/javascript">

	function showCycleForward(){ //流程跳转
 		var url = "${ctx}/renovation_renovationForwordAction.do?method=renovationForwordSmall";
		top.windowOpen(url, "renovationForward", "装修流程", 320, 900);
	}
	function cycleForward(url){
   		window.location.href=url;
	}
	var renovateViolitionId = null;
	function setRenovateViolitionId(id){
		renovateViolitionId= id;
	}
	//添加
	function openRenovateViolationAdd(){
		var url = "${ctx}/renovation_renovateViolationAction.do?method=initRenovateViolationAdd";
		top.windowOpen(url, 'houseChoose', '${key.add}', 430, 700, true, "houseChoose");
	}
	//修改
	function openRenovateViolationEdit(){
		if(renovateViolitionId == null){
			ErrorAlert("${key.tipsByModify}");
			return false;
		}
		else{
			var hasReforms = "${ctx}/renovation_renovateViolationAction.do?method=validateRenovateViolationEdit&renovateViolationId="+renovateViolitionId;
			new Ajax.Request(hasReforms,
		         { method:'post',
				   parameters:{},
				   onComplete:function(response){
					if(response.responseText == 'false'){
						Alert('该装修违规已经做了处理，不能修改！');
					}else{
						var url = "${ctx}/renovation_renovateViolationAction.do?method=initRenovateViolationEdit&renovateViolationId="+renovateViolitionId;
						top.windowOpen(url, 'houseChoose', '${key.modify}',430, 700,  true, "houseChoose");
				   }
				 }});
		}
	}
	//提示删除
	function showRenovateViolationDelete(){
		if( renovateViolitionId == null ){
			ErrorAlert('${key.tipsByDelete}');
		}else{
			var hasHandle = "${ctx}/renovation_renovateViolationAction.do?method=validateRenovateViolationEdit&renovateViolationId="+renovateViolitionId;
			new Ajax.Request(hasHandle,
		         	{method:'post',
				   	parameters:{},
				   	onComplete:function(response){
						if(response.responseText == 'false'){
							ErrorAlert("该装修违规已经做了处理，不得进行删除！");
						}else{
							AlarmConfirm('${key.tipsByDeleteConfirm}',"main","deleteRecord");
				   		}
				 	}
				 });
		}
	}
	//删除
	function deleteRecord(){
		var url="${ctx}/renovation_renovateViolationAction.do?method=deleteRenovateViolation";
		var parameter = "renovateViolationId="+renovateViolitionId;
		var myAjax = new Ajax.Request(
            	url,
            	{method: 'post', parameters:parameter , onComplete: showResponseDelete}
            );
	}
	//删除后处理
	function showResponseDelete(transport){
		ajaxSubmitException(transport.responseText);
		if(transport.responseText=="false"){
			FailureAlert('${key.doFalse}');
		}else{
			reloadRenovate();
		}
	}
	function openReformMain(){
		var url = "${ctx}/renovation_renovateViolationAction.do?method=initReformMain&renovateViolationId="+renovateViolitionId;
		top.windowOpen(url, 'editPage', '整改验收', 380, 700, true, "editPageIframe");
	}
	function renovateViolationSearch(){
		var url="${ctx}/renovation_renovateViolationAction.do?method=setRenoViolateConditionCache";
   		var parameters = Form.serialize('searchForm');
   		new Ajax.Request(url,{method: 'post', parameters: parameters, onComplete: showResponse});
	}
	function showResponse(response){
	   reloadRenovate();
    }
	function showAdivceSearch(){
		var url = "${ctx}/renovation_renovateViolationAction.do?method=initRenovateViolationSeniorSearch";
		top.windowOpen(url, "houseChoose", "高级查询", 400,580,true,"houseChoose" );
	}
	function reloadRenovate(){
	    renovateViolitionId = null;
		$('renovateViolationList').src="${ctx}/renovation_renovateViolationAction.do?method=queryRenovateViolationList";
	}
	
	//状态改变后，如果是选择通过则默认选择包含验收通过
	function stateOnChange(){
		if("003"==$("state").value){
			$("containPassed").checked = true;
		}
	}
	
	//违规处理
	function violationHandler(){
		if(renovateViolitionId == null){
			ErrorAlert("请先选择您要处理的记录");
			return false;
		}
		var hasHandle = "${ctx}/renovation_renovateViolationAction.do?method=validateHandle&renovateViolationId="+renovateViolitionId;
		new Ajax.Request(hasHandle,
	         { method:'post',
			   parameters:{},
			   onComplete:function(response){
				if(response.responseText == 'hasreforms'){
					ErrorAlert("该装修违规已进入完工验收阶段，不得进行违规处理！");
				//}else if(response.responseText == 'false'){
				//	ErrorAlert("本装修违规不是自己责任部门，不得进行违规处理！");
				}else{
					var url = "${ctx}/renovation_renovateViolationAction.do?method=initRenovateViolationHandle&renovateViolationId="+renovateViolitionId;
					top.windowOpen(url, 'violationHandler', '违规处理',600, 800,  true, "violationHandler");
			   }
			 }});
	}
	//完工验收
	function checkFinish(){
		if(renovateViolitionId == null){
			ErrorAlert("请先选择您要完工验收的记录");
			return false;
		}
		var validateReform = "${ctx}/renovation_renovateViolationAction.do?method=validateReform&renovateViolationId="+renovateViolitionId;
		new Ajax.Request(validateReform,
	         { method:'post',
			   parameters:{},
			   onComplete:function(response){
				if(response.responseText == 'pass'){
					ErrorAlert("该违规记录已经整改验收通过，不得再做完工验收！");
				}else if(response.responseText == 'unhandled'){
					ErrorAlert("该违规记录未做违规处理，不得进行完工验收！");
				}else{
					var url = "${ctx}/renovation_renovateViolationAction.do?method=initReformMain&renovateViolationId="+renovateViolitionId;
					top.windowOpen(url, 'reformMain', '完工验收', 380, 700, true, "reformMain");
			   }
			 }});
	}
	//整改验收
	function checkPass(){
		if(renovateViolitionId == null){
			ErrorAlert("请先选择您要整改验收的记录");
			return false;
		}
		var hasHandle = "${ctx}/renovation_renovateViolationAction.do?method=validateCheckReform&renovateViolationId="+renovateViolitionId;
		new Ajax.Request(hasHandle,
	         { method:'post',
			   parameters:{},
			   onComplete:function(response){
				if(response.responseText == 'pass'){
					ErrorAlert("该违规记录已经整改验收通过，不得做整改验收！");
				}else if(response.responseText == 'unfinished'){
					ErrorAlert("该违规整改未完工，不得整改验收！");
				}else{
					var url = "${ctx}/renovation_renovateViolationAction.do?method=initReformCheck&renovateViolationId="+renovateViolitionId;
					top.windowOpen(url, 'reformCheck', '整改验收',180, 450,  true, "reformCheck");
			   }
			 }});
	}
	//整改跟进
	function renovateFollow(){
		if(renovateViolitionId == null){
			ErrorAlert("请先选择您要跟进的违规记录");
			return false;
		}
		var url = "${ctx}/renovation_renovateViolationAction.do?method=initFollowMain&renovateViolationId="+renovateViolitionId;
		top.windowOpen(url, 'followMain', '整改跟进记录', 460, 700, true, "followMain");
	}
	//详细资料
	function showInfo(){
		if(renovateViolitionId == null){
			ErrorAlert("请先选择您要查看详细的记录");
			return false;
		}
		var url = "${ctx}/renovation_renovateViolationAction.do?method=getRenovateViolationDetail&renovateViolationId="+renovateViolitionId;
    	top.windowOpen(url, "ChargeItemDetail", "装修监管详细", 600, 800);
	}
	//统计分析
	function showStatistics(){
		var url = "${ctx}/renovation_renovateViolationAction.do?method=initRenovateViolationStatistic";
		top.windowOpen(url, 'renovateViolationStatistic', '统计分析', 500, 700, true, "renovateViolationStatistic");
	}
</script>
</head>
<body>
<!--style="display:none"-->
<div class="pageNav_bg">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td id="pageNav_leftimg"><img
			src="${ctx}/images/ico_zxgl_zxjg.gif" width="46" height="47" /></td>
		<td id="navWord"><span class="page_title">装修监管</span></td>
		<td class="pageNav_right"><a href="#" style="CURSOR: hand;"
			onFocus="this.blur()" onClick="showCycleForward();"><img
			src="${ctx}/images/charage_buzhou11.gif" border="0"></a> <a
			href="javascript:showFull_in();"><img id="full_image"
			src="${ctx}/images/ico_fullscreen.gif" border="0" /></a></td>
	</tr>
</table>
</div>
<div class="container">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<form name="searchForm" method="post"
		action="${ctx}/renovation_renovateViolationAction.do?method=queryRenovateViolationInfo"
		target="renovateViolationList">
	<tr>
		<td>
		<table width="100%" border="0" cellpadding="0" cellspacing="0"
			id="search01" class="bg_search2">
			<tr>
				<td>
				<table border="0" cellpadding="0" cellspacing="1">
					<tr>
						<td class="grid align_right">楼栋：</td>
						<td class="td_search align_left"><pms:unitedSelect
							name="buildingId" optionLabel="name" optionValue="keyword"
							selectText="请选择" dataList="${buildList}" style="width:110px;">
						</pms:unitedSelect></td>
						<td class="grid align_left">房号：</td>
						<td class="td_search align_left"><input name="houseNumber"
							type="text" class="" size="15" /></td>
						<td class="grid align_left">状态：</td>
						<td class="td_search align_left" colspan="3"><pms:unitedSelect
							onChange="stateOnChange()" name="state" optionLabel="name"
							optionValue="value" selectText="请选择" dataList="${stateList}"
							style="width:110px;" /></td>
					</tr>
					<tr>
						<td class="grid align_center" colspan="2"><input
							type="checkbox" name="containPassed" value="1">包含验收通过</input>&nbsp;&nbsp;</td>
						<td class="grid align_left">责任部门：</td>
						<td class="td_search align_left"><pms:unitedSelect
							name="deptId" optionLabel="deptName" optionValue="deptId"
							selectText="请选择" dataList="${burdenDeptList}"
							style="width:110px;" /></td>
						<td class="grid align_left">违规类别：</td>
						<td class="td_search align_left"><pms:unitedSelect
							name="categoryId" optionLabel="name" optionValue="keyword"
							selectText="请选择" dataList="${categoryList}" style="width:110px;" />
						</td>
						<td class="td_search">
						<table border="0" cellpadding="0" cellspacing="0"
							onclick="renovateViolationSearch()">
							<tr>
								<td class="buttonOffLeft" id="btn1_111"></td>
								<td class="buttonOffMiddle" id="btn1_112"
									onblur="btn_change(11)" onMouseOver="btn_change_over(11)"
									onMouseOut="btn_change_out(11)"><img
									src="${ctx}/images/ico_searchico.gif" alt="" border="0"
									align="absmiddle" /> 查 询</td>
								<td class="buttonOffRight" id="btn1_113"></td>
							</tr>
						</table>
						</td>
						<td>
						<table border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td class="buttonOffLeft" id="btn1_81"></td>
								<td class="buttonOffMiddle" id="btn1_82" onblur="btn_change(8)"
									onMouseOver="btn_change_over(8)" onMouseOut="btn_change_out(8)">
								<a href="#" onFocus="this.blur()" onClick="showAdivceSearch();"
									style="color: #000;">高级查询</a></td>
								<td class="buttonOffRight" id="btn1_83"></td>
							</tr>
						</table>
						</td>
						<pms:AuthTag
							authName="renovation_renovateViolationAction.do?method=initRenovateViolationStatistic">
							<td class="btn_between_space"></td>
							<td>
							<table border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td class="buttonOffLeft" id="btn1_71"></td>
									<td class="buttonOffMiddle" id="btn1_72" onblur="btn_change(7)"
										onMouseOver="btn_change_over(7)"
										onMouseOut="btn_change_out(7)"><a href="#"
										onFocus="this.blur()" onClick="showStatistics();"
										style="color: #000;">统计分析</a></td>
									<td class="buttonOffRight" id="btn1_73"></td>
								</tr>
							</table>
							</td>
						</pms:AuthTag>
						<td>
						<table border="0" cellpadding="0" cellspacing="0">
						</table>
						</td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td class="bg_toolBar">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="25%"></td>
				<td width="75%" align="right"><!--------------------------右边图标01----------------------------------->
				<table border="0" cellpadding="0" cellspacing="0" id="ico1">
					<tr>
						<pms:AuthTag
							authName="renovation_renovateViolationAction.do?method=addRenovateViolation">
							<td class="toolbarico"><a href="javascript:void(0)"
								onClick="openRenovateViolationAdd();" onFocus="this.blur()"><img
								src="${ctx}/images/ico_newfile.gif" alt="违规登记" width="16"
								height="16" border="0" align="absbottom" />&nbsp;</a></td>
						</pms:AuthTag>
						<pms:AuthTag
							authName="renovation_renovateViolationAction.do?method=editRenovateViolation">
							<td class="toolbarico"><a href="javascript:void(0)"
								onClick="openRenovateViolationEdit();" onFocus="this.blur()"><img
								src="${ctx}/images/ico_amend.gif" border="0" align="absbottom"
								alt="修改违规登记" />&nbsp;</a></td>
						</pms:AuthTag>
						<pms:AuthTag
							authName="renovation_renovateViolationAction.do?method=deleteRenovateViolation">
							<td class="toolbarico"><a href="javascript:void(0)"
								onClick="showRenovateViolationDelete();" onFocus="this.blur()"><img
								src="${ctx}/images/ico_delete.gif" alt="删除" width="16"
								height="16" border="0" align="absbottom" /></a></td>
						</pms:AuthTag>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td valign="top"><iframe
			src="${ctx}/renovation_renovateViolationAction.do?method=initRenovateViolationList"
			name="renovateViolationList" id="renovateViolationList" width="100%"
			height="400px" frameborder="0" scrolling="auto"> </iframe></td>
	</tr>
</table>
</div>
</body>
</html>
